import {IResponse} from "@/common/common";
import request from "@/common/request";
import {parseMomentArr} from "@/common/util";
import _ from "lodash";

export const DATE_FORMAT = "YYYYMMDD_HHmmss";

function convertParams(para: any) {
  const params = _.cloneDeep(para);
  if (params.createTimes) {
    const [t1, t2] = parseMomentArr(params.createTimes, DATE_FORMAT);
    params.create_time_begin = t1;
    params.create_time_end = t2;
    delete params.createTimes;
  }
  return params;
}

// 获取雷达列表
export async function apiQueryRadarList(params: any): Promise<IResponse> {
  return request({url: `/v1/app/radar/list`, method: "GET", params});
}

// 获取融合组详情
export async function apiQueryCalibrateListData(params: any): Promise<IResponse> {
  const newParams = convertParams(params);
  console.log(newParams)
  return request({url: `/v1/app/fusion`, method: "GET", params});
}
